<script>
export default {
  beforeCreate() {
    const { params, query } = this.$route
    const { path } = params
    let route = this.$_.get(this.$router.resolve('/' + path), 'route')
    if (route && route.name) { // 这里删除缓存路由需要route 的 name
      this.$store.dispatch('delCachedView', route).then(_ => {
        this.$router.replace({path: '/' + path, query})
      })
    } else {
      this.$router.replace({path: '/' + path, query})
    }
  },
  render: function(h) {
    return h() // avoid warning message
  }
}
</script>
